package webview.test.activity;

import webview.test.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity {

	private Button videoLocalBtn = null;
	private Button mediaPalyLocalBtn = null;
	private Button videoHttpBtn = null;
	private Button mediaPalyHttpBtn = null;
	private Button audioHttpBtn = null;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		videoLocalBtn = (Button) findViewById(R.id.videovLocalBtn);
		videoLocalBtn.setOnClickListener(new videoClick());

		mediaPalyLocalBtn = (Button) findViewById(R.id.mediaPlayLocalBtn);
		mediaPalyLocalBtn.setOnClickListener(new videoClick());

		videoHttpBtn = (Button) findViewById(R.id.videovHttpBtn);
		videoHttpBtn.setOnClickListener(new videoClick());

		mediaPalyHttpBtn = (Button) findViewById(R.id.mediaPlayHttpBtn);
		mediaPalyHttpBtn.setOnClickListener(new videoClick());

		audioHttpBtn = (Button) findViewById(R.id.audioHttpBtn);
		audioHttpBtn.setOnClickListener(new videoClick());
	}

	class videoClick implements OnClickListener {

		@Override
		public void onClick(View v) {
			/*			Intent intent = new Intent();
						intent.putExtra("who", "who are you");
						intent.setClass(HelloworldadActivity.this, MonkeyActivity.class);
						// HelloworldadActivity.this.startActivity(intent);
						HelloworldadActivity.this.startActivity(intent);*/
			String Local = Environment.getExternalStorageDirectory() + "/video.3gp";
			String audiohttp = "http://q.t99.cn/source/7/9/9/7/7997P3UWl1GE.mp3";
			String http = "http://www.ooklnet.com/files/381/381489/video.mp4";
			Intent intent = new Intent();

			switch (v.getId()) {
			case R.id.videovLocalBtn:
				System.out.println("go to videovLocalBtn");
				intent.putExtra("path", Local);
				intent.setClass(MainActivity.this, VideoViewActivity.class);
				break;
			case R.id.mediaPlayLocalBtn:
				System.out.println("go to mediaPlayLocalBtn");
				intent.putExtra("media", 4);
				intent.putExtra("path", Local);
				intent.setClass(MainActivity.this, MediaPlayerActivity.class);
				break;
			case R.id.videovHttpBtn:
				System.out.println("go to videovHttpBtn");
				intent.putExtra("path", audiohttp);
				intent.setClass(MainActivity.this, VideoViewActivity.class);
				break;
			case R.id.mediaPlayHttpBtn:
				System.out.println("go to mediaPlayHttpBtn");
				intent.putExtra("media", 5);
				intent.putExtra("path", audiohttp);
				intent.setClass(MainActivity.this, MediaPlayerActivity.class);
				break;
			case R.id.audioHttpBtn:
				System.out.println("go to videovHttpBtn");
				intent.putExtra("path", audiohttp);
				// sheet切换测试
				intent.setClass(MainActivity.this, MainActivityGroup.class);
				// line chart测试
				// intent.setClass(MainActivity.this, ChartStep.class);
				break;

			}
			startActivity(intent);
		}
	}

}